package com.cfec.educationplatform.domain;

import com.baomidou.mybatisplus.annotation.*;

import java.util.Date;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.stereotype.Component;

/**
 * 拍照上传的题目信息表
 * @TableName tb_topic
 */
@TableName(value ="tb_topic")
@Data
@Component
public class TbTopic {
    /**
     * id
     */
    @TableId
    private Integer topicId;

    /**
     * 题目分类：0：数学；1：物理；2：化学；3：英语；4：语文
     */
    private String topicClassify;

    /**
     * 上传的图片
     */
    private String topicImage;

    /**
     * 题目描述信息（选填）
     */
    private String topicLabel;

    /**
     * 该题的答案
     */
    private String topicAnswer;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    /**
     * 信息状态：0：弃用，1：使用
     */
    private String topicState;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        TbTopic other = (TbTopic) that;
        return (this.getTopicId() == null ? other.getTopicId() == null : this.getTopicId().equals(other.getTopicId()))
            && (this.getTopicClassify() == null ? other.getTopicClassify() == null : this.getTopicClassify().equals(other.getTopicClassify()))
            && (this.getTopicImage() == null ? other.getTopicImage() == null : this.getTopicImage().equals(other.getTopicImage()))
            && (this.getTopicLabel() == null ? other.getTopicLabel() == null : this.getTopicLabel().equals(other.getTopicLabel()))
            && (this.getTopicAnswer() == null ? other.getTopicAnswer() == null : this.getTopicAnswer().equals(other.getTopicAnswer()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getTopicState() == null ? other.getTopicState() == null : this.getTopicState().equals(other.getTopicState()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getTopicId() == null) ? 0 : getTopicId().hashCode());
        result = prime * result + ((getTopicClassify() == null) ? 0 : getTopicClassify().hashCode());
        result = prime * result + ((getTopicImage() == null) ? 0 : getTopicImage().hashCode());
        result = prime * result + ((getTopicLabel() == null) ? 0 : getTopicLabel().hashCode());
        result = prime * result + ((getTopicAnswer() == null) ? 0 : getTopicAnswer().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getTopicState() == null) ? 0 : getTopicState().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", topicId=").append(topicId);
        sb.append(", topicClassify=").append(topicClassify);
        sb.append(", topicImage=").append(topicImage);
        sb.append(", topicLabel=").append(topicLabel);
        sb.append(", topicAnswer=").append(topicAnswer);
        sb.append(", creatTime=").append(createTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", topicState=").append(topicState);
        sb.append("]");
        return sb.toString();
    }
}